# Contributor: Michael Jeanson <mjeanson@efficios.com>
# Contributor: Fabian Affolter <fabian@affolter-engineering.ch>
# Maintainer: Fabian Affolter <fabian@affolter-engineering.ch>
pkgname=userspace-rcu
pkgver=0.14.0
pkgrel=2
pkgdesc="Userspace RCU (read-copy-update) library"
url="https://liburcu.org/"
arch="all"
license="LGPL-2.1-or-later"
makedepends="bash perl perl-utils"
subpackages="$pkgname-static $pkgname-dev $pkgname-doc"
source="https://lttng.org/files/urcu/userspace-rcu-$pkgver.tar.bz2"

build() {
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--sysconfdir=/etc \
		--mandir=/usr/share/man \
		--infodir=/usr/share/info \
		--localstatedir=/var
	make V=1
}

check() {
	make check
	#make regtest # Somewhat long regression tests
}

package() {
	make DESTDIR="$pkgdir" install
	install -Dm644 LICENSE "$pkgdir"/usr/share/licenses/$pkgname/LICENSE
}

dev() {
	default_dev
	# Move back examples files that are wrongly included
	# by the default dev splitfunc
	cp -pr "$subpkgdir"/usr/share/doc/$pkgname \
		"$pkgdir"/usr/share/doc/
	rm -rf "$subpkgdir"/usr/share/doc/
}

static() {
	depends=""
	pkgdesc="$pkgdesc (static libraries)"
	mkdir -p "$subpkgdir"/usr/lib
	mv "$pkgdir"/usr/lib/*.a "$subpkgdir"/usr/lib
}

sha512sums="
7297e51012f4c44ee27c0e18ed9d87bf24be34db68a5398394c1e683a045bb561cf74aa913398404c0ed5cb8011af728ea12947717fa5f27627e5ca78e63a40f  userspace-rcu-0.14.0.tar.bz2
"
